package com.lzw.common.bean;

/**
 * Created by 林志伟 on 2017/5/15.
 */
public class Result {
    private int code=0;
    private  String msg="";
    private  Object data=null;


    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {

        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    /**
     * 是否成功
     * @return
     */
    public boolean isSuccess(){
        if(code==0){
            return  true;
        }else{
            return  false;
        }
    }

    /**
     * 是否错误
     * @return
     */
    public boolean isError(){
        if(code==1){
            return  true;
        }else{
            return  false;
        }
    }

    @Override
    public String toString() {
        return "Result{" +
                "    code=" + code +
                ",     msg='" + msg + '\'' +
                ",     data=" + data +
                '}';
    }
}
